package com.thinking.dubbo.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.thinking.dubbo.api.BusinessService;

import com.thinking.dubbo.config.TtlThreadUtil;
import com.thinking.dubbo.pojo.Business;
import com.thinking.dubbo.mapper.BusinessMapper;
import org.apache.dubbo.config.annotation.DubboService;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName BusinessServiceImpl
 * @Description TODO
 * @Author tangsixiang@gmail.
 * @Date 2023/6/3 15:48
 * @Version 1.0
 */

@DubboService
public class BusinessServiceImpl  implements BusinessService {
    @Resource
    BusinessMapper mapper;
    @Override
    public Integer saveData(Business business) {
        return mapper.insert(business);
    }


    @Override
    public List<Business> queryBusiness(String lang) {
        TtlThreadUtil.getThreadLocal().set(lang);
        System.out.println("lang = " + lang);
        return queryBusiness();
    }
    @Override
    public List<Business> queryBusiness() {
        return mapper.selectList(new QueryWrapper<Business>().lambda());
    }
}
